package gamefw.tests.implementations.game;

import gamefw.framework.Coordinate;
import gamefw.gameplugin.AbstractGameLogic;
import gamefw.gameplugin.AbstractPlayer;
import gamefw.gameplugin.PlayResult;

public class SimpleGameLogic extends AbstractGameLogic {

	private int numPlayers;
	private int maxLoops;
	private int numLoops;

	SimpleGameLogic(int numPlayers, int maxLoops){
		this.maxLoops = maxLoops;
		this.numLoops = 0;
		this.numPlayers = numPlayers;
	}
	
	SimpleGameLogic() {
		this(2, 0);
	}
	
	@Override
	public int getPlayersNumber() {
		return this.numPlayers;
	}

	@Override
	public AbstractPlayer getWinner() {
		return new SimplePlayer();
	}

	@Override
	public int getNextPlayerIndex() {
		return 0;
	}

	@Override
	public boolean isGameOver() {
		return this.numLoops >= this.maxLoops;
	}

	@Override
	public String[] getInitialEntities() {
		return new String[0];
	}

	@Override
	protected void handlePlayResult(PlayResult result) {
		this.numLoops++;
	}

	@Override
	protected void preDisplay() {
	}

	@Override
	protected void postDisplay() {
	}

	@Override
	public void initialize() {
	}

	@Override
	public String getGameTitle() {
		return "testGame";
	}

	@Override
	public Coordinate getScreenSize() {
		return new Coordinate(640, 480);
	}

	@Override
	public void onQuit() {
		// TODO Auto-generated method stub
		System.exit(0);
	}

}
